// pages/addteam/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    AddTeamName:"",
    AddTeamLeaderName:"",
    StudentID:"",
    GroupID:
      {
        GroupName:"",
        Introduction:""
      }
    
  },

  onload: function(e){
    
  },
  //将团队名称传入
  getAddTeamName: function (e) {
    let value = e.detail.value;
    console.log( e.detail.value)
    this.setData({
      'GroupID.GroupName': value,
    })
    wx.setStorageSync('AddTeamName', value);
  },
  //将队长名字传入
  getLearderName: function (e) {
    let value = e.detail.value;
    console.log( e.detail.value)
    this.setData({
      AddTeamLeaderName: value,
    })
    wx.setStorageSync('getLearderName', value);
  },
  //讲电话传入
  // getLeaderTelrName: function (e) {
  //   let value = e.detail.value;
  //   console.log( e.detail.value)
  //   // this.setData({
  //   //   AddTeamName: value,
  //   // })
  //   wx.setStorageSync('getLeaderTelrName', value);
  // },
  //备注传入
  Teamreamrk: function (e) {
    let value = e.detail.value;
    // console.log( e.detail.value)
    this.setData({
      'GroupID.Introduction': value,
    })
    wx.setStorageSync('Teamreamrk', value);
  },
  submitMeetInfo: function (e) {
    let StudentID = wx.getStorageSync("StudentID");
    this.setData({
      StudentID: StudentID,
    })
    
    var that = this;
    console.log(that.data.GroupID);
    const groupId = that.data.GroupID
    //像后端传值
    wx.request({
      url:'http://172.17.60.141/group/Member', 
      data: {
        GroupID: {
            GroupName:groupId.GroupName,
            Introduction:groupId.Introduction
          
        },
        StudentID:StudentID,
        Auth:1
        // leader_name: this.data.AddTeamLeaderName,
      },

      method: 'POST',
      // header: {}, // 设置请求的 header 默认是application/json
      success: function (res) {
          console.log(res.data)
        //   that.setData({       //this.setData的方法用于把传递过来的id转化成小程序模板语言
        //   data: res.data    //拿到该商品详情对应的商品id，再调用getProdutInfo方法
        // })
      },
      fail: function () {
        // fail
        console.log("false");
      },
      complete: function () {
        // complete
      }
    })
    wx.navigateTo({
      url:'/pages/teamInfo/index',
    })
  },
})